package com.ssf.hsdtouch.fragment;

import com.ssf.hsdtouch.R;
import com.ssf.hsdtouch.R.layout;
import com.ssf.hsdtouch.entiy.FileObj;

import uk.co.senab.photoview.PhotoView;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class PicFragment extends Fragment {
	Activity context;
	private PhotoView picView;
	private String path;
	private FileObj obj;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		picView = (PhotoView) inflater.inflate(R.layout.layout_pic, null);
		return picView;
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		context = getActivity();
		path = getArguments().getString("path");
		obj = (FileObj) getArguments().getSerializable("file");
		path = obj.getFilePath();
		super.onCreate(savedInstanceState);
	}

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		super.onViewCreated(view, savedInstanceState);
		picView.setImageURI(Uri.parse(path));
	}
}
